const HWP = require('html-webpack-plugin');

/** @type {import('webpack').Configuration} */
const config = {
    entry: "./src/game.js",
    mode: 'development',
    devtool: 'eval-source-map',
    optimization: {
        minimize: false,
    },
    output: {
        filename: '[name].js',
        clean: true
    },
    plugins: [
        new HWP({
            title: 'toy-react'
        })
    ],
    module: {
        rules: [
            {
                test: /\.js$/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env'],
                        plugins: [
                            ['@babel/plugin-transform-react-jsx',
                                {
                                    pragma: 'createElement'
                                }
                            ],
                        ],
                    }
                }
            },
            { test: /\.css$/, use: ['style-loader', 'css-loader'] }
        ]
    }
}
module.exports = config